import java.io.*;

public class SharedObject implements Serializable, SharedObject_itf {
	
	private int lock;
	private int id;//id du SharedObject unique au serveur
	//private int id_client;//id du client
	static Object obj;//pointe sur l'object effectif
	
	private int NL = 0;
	private int RLC = 1;
	private int WLC = 2;
	private int RLT = 3;
	private int WLT = 4;
	private int RLT_WLC = 5;
	
	
	public SharedObject(int i, Object o){
		this.id=i;
		this.obj=o;
		this.lock=NL;
	}
	//on l'a ajouté
	public int getId(){
		return id;
	}
	
	
	// invoked by the user program on the client node
	public void lock_read() {
		if(this.lock==NL){
			this.lock = RLT;
			Client.lock_read(id);}
		//faire switch
	}

	// invoked by the user program on the client node
	public void lock_write() {
	}

	// invoked by the user program on the client node
	public synchronized void unlock() {
	}


	// callback invoked remotely by the server
	public synchronized Object reduce_lock() {return null;
	}

	// callback invoked remotely by the server
	public synchronized void invalidate_reader() {
	}

	public synchronized Object invalidate_writer() {return null;
	}
}
